package com.winter.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.winter.model.Company;
import com.winter.service.CompanyPositionService;
import com.winter.service.CompanyService;
import com.winter.service.DictEntryService;
import com.winter.util.Result;
/**
 * 职场模块   高端职位
 * @author Administrator
 *
 */
@RestController
@RequestMapping("/company")
public class CompanyController {

	@Autowired
	private CompanyService service;
	
	@Autowired
	private CompanyPositionService companyPositionService;
	
	@Autowired
	private DictEntryService dictEntryService;
	
	
	/**
	 *  高端职位列表查询
	 * @param pageSize
	 * @param pageNumber
	 * @param timeStart
	 * @param timeEnd
	 * @param companyIndustry
	 * @return
	 */
    @GetMapping("/querypage")
    public Result queryPage(Integer pageSize, Integer pageNumber,Long compId, String timeStart, String timeEnd, String companyIndustry,String companyName,String userNo,Integer dcTime,String key) {
        return companyPositionService.queryPageList(pageNumber, pageSize, compId,timeStart, timeEnd, companyIndustry,companyName,userNo,dcTime, key);
    }
    
    /**
     * 根据Id查询 高端职位信息
     * @param id
     * @return
     */
    @GetMapping("/querybyid")
    public Result querybyid(Long id,String createUser){
    	return companyPositionService.selectByPrimaryKey(id, createUser);
    }
    
    /**
     * 添加公司getIcom
     * @param record
     * @return
     */
    @PostMapping("/insert")
    public Result insert(@RequestBody Company record){
    	return service.insert(record);
    }
    
    /**
     * 根据公司id删除
     * @param id
     * @return
     */
    @DeleteMapping("/delete")
    public Result delete(Long id){
    	return service.delete(id);
    }
    
    /**
     * 根据公司id修改
     * @param id
     * @return
     */
    @PutMapping("/update")
    public Result update(@RequestBody Company record){
    	return service.update(record);
    }
   
    /**
     * 获取字典分类
     * @param record
     * @return
     */
    @GetMapping("/queryindustry")
    public Result queryIndustry(String name){
    	return dictEntryService.queryIndustry(name);
    }

    /*
     * 公司圈列表
     */
	@GetMapping("/icompanyList")
    public Result icompanyCardList(Integer pageSize, Integer pageNumber,String comClass,String comSubClass,String userNo,String key){
    	return service.icompanyCardList(pageSize,pageNumber,comClass,comSubClass,userNo,key);
    }
	
	/*
     * 通过id查询公司圈信息
     */
	@GetMapping("/getIcom")
    public Result getIcomCard(Long id,String userNo){
      return service.getIcomCard(id,userNo);
    }

}
